home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1993-11-10 | 17.5 KB | 629 lines | [ TEXT/MPS ]
{*********************************************************** Created: Monday, November 8, 1993 12:03PM OCEStandardMail.p Pascal Interface to the Macintosh Libraries Copyright Apple Computer, Inc. 1990-1993 All rights reserved ***********************************************************} {$IFC UNDEFINED UsingIncludes} {$SETC UsingIncludes:= 0} {$ENDC} {$IFC NOT UsingIncludes} UNIT OCEStandardMail; INTERFACE {$ENDC} {$IFC UNDEFINED UsingOCEStandardMail} {$SETC UsingOCEStandardMail:= 1} {$I+} {$SETC OCEStandardMailIncludes:= UsingIncludes} {$SETC UsingIncludes:= 1} {$IFC UNDEFINED UsingAppleEvents} {$I $$Shell(PInterfaces)AppleEvents.p} {$ENDC} {$IFC UNDEFINED UsingFiles} {$I $$Shell(PInterfaces)Files.p} {$ENDC} {$IFC UNDEFINED UsingOCEAuthDir} {$I OCEAuthDir.p} {$ENDC} {$IFC UNDEFINED UsingOCEMail} {$I OCEMail.p} {$ENDC} {$IFC UNDEFINED UsingWindows} {$I $$Shell(PInterfaces)Windows.p} {$ENDC} {$IFC UNDEFINED UsingDialogs} {$I $$Shell(PInterfaces)Dialogs.p} {$ENDC} {$SETC UsingIncludes:= OCEStandardMailIncludes} CONST gestaltSMPMailerVersion = 'malr'; gestaltSMPSPSendLetterVersion = 'spsl'; kSMPNativeFormatName = 'natv'; kSMPVersion = 1; TYPE LetterSpec = RECORD spec: ARRAY[1..3] OF LONGINT; END; CONST typeLetterSpec = 'lttr'; { Wildcard used for filtering letter types. } CONST FilterAnyLetter = 'ltr*'; FilterAppleLetterContent = 'ltc*'; FilterImageContent = 'lti*'; TYPE LetterDescriptor = RECORD onDisk: BOOLEAN; CASE INTEGER OF 1: (fileSpec: FSSpec); 2: (mailboxSpec: LetterSpec); END; { SMPPSendAs values. You may add the following values together to determine how the file is sent, but you may not set both kSMPSendAsEnclosureMask and kSMPSendFileOnlyMask. This will allow you to send the letter as an image so that it will work with fax gateways and send as an enclosure as well. } CONST kSMPSendAsEnclosureBit = 0; { Appears as letter with enclosures } kSMPSendFileOnlyBit = 1; { Appears as a file in mailbox. } kSMPSendAsImageBit = 2; { Content imaged in letter } { Values of SMPPSendAs } kSMPSendAsEnclosureMask = $01; {1<<kSMPSendAsEnclosureBit} kSMPSendFileOnlyMask = $02; {1<<kSMPSendFileOnlyBit} kSMPSendAsImageMask = $04; {1<<kSMPSendAsImageBit} TYPE SMPPSendAs = Byte; { Send Package Structures } SMPDrawImageProcPtr = ProcPtr; { FUNCTION SMPDrawImageProcPtr(refcon: LONGINT; inColor: BOOLEAN): void;} SMPRecipientDescriptor = RECORD next: ^SMPRecipientDescriptor; { Q-Link. } result: OSErr; { result code when using the object. } recipient: ^OCEPackedRecipient; { Pointer to a Packed Address. } size: LONGINT; { length of recipient in bytes. } theAddress: MailRecipient; { structure points into recipient and theRID. } theRID: RecordID; { structure points into recipient. } END; SMPRecipientDescriptorPtr = ^SMPRecipientDescriptor; SMPEnclosureDescriptor = RECORD next: ^SMPEnclosureDescriptor; result: OSErr; fileSpec: FSSpec; fileCreator: OSType; { Creator of this enclosure. } fileType: OSType; { File Type of this enclosure. } END; SMPEnclosureDescriptorPtr = ^SMPEnclosureDescriptor; SMPLetterPB = PACKED RECORD result: OSErr; { result of operation } subject: RStringPtr; { RString } senderIdentity: AuthIdentity; { Letter is sent from this Identity } toList: SMPRecipientDescriptorPtr; { Pointer to linked list } ccList: SMPRecipientDescriptorPtr; { Pointer to linked list } bccList: SMPRecipientDescriptorPtr; { Pointer to linked list } script: ScriptCode; { Identifier for language } textSize: Size; { length of body data } textBuffer: Ptr; { body of the letter } sendAs: SMPPSendAs; { Send as Letter, Enclosure, Image } padByte: Byte; enclosures: SMPEnclosureDescriptorPtr; { files to be enclosed } drawImageProc: SMPDrawImageProcPtr; { For imaging } imageRefCon: LONGINT; { For imaging } supportsColor: BOOLEAN; { For imaging - set to true if you application supports color imaging } END; SMPLetterPBPtr = ^SMPLetterPB; CONST kSMPAppMustHandleEventBit = 0; kSMPAppShouldIgnoreEventBit = 1; kSMPContractedBit = 2; kSMPExpandedBit = 3; kSMPMailerBecomesTargetBit = 4; kSMPAppBecomesTargetBit = 5; kSMPCursorOverMailerBit = 6; kSMPCreateCopyWindowBit = 7; kSMPDisposeCopyWindowBit = 8; { Values of SMPMailerResult } kSMPAppMustHandleEventMask = $00000001; {1<<kSMPAppMustHandleEventBit} kSMPAppShouldIgnoreEventMask = $00000002; {1<<kSMPAppShouldIgnoreEventBit} kSMPContractedMask = $00000004; {1<<kSMPContractedBit} kSMPExpandedMask = $00000008; {1<<kSMPExpandedBit} kSMPMailerBecomesTargetMask = $00000010; {1<<kSMPMailerBecomesTargetBit} kSMPAppBecomesTargetMask = $00000020; {1<<kSMPAppBecomesTargetBit} kSMPCursorOverMailerMask = $00000040; {1<<kSMPCursorOverMailerBit} kSMPCreateCopyWindowMask = $00000080; {1<<kSMPCreateCopyWindowBit} kSMPDisposeCopyWindowMask = $00000100; {1<<kSMPDisposeCopyWindowBit} TYPE SMPMailerResult = LONGINT; CONST { Values of SMPMailerComponent} kSMPOther = -1; kSMPFrom = 32; kSMPTo = 20; kSMPRegarding = 22; kSMPSendDateTime = 29; kSMPAttachments = 26; kSMPAddressOMatic = 16; TYPE SMPMailerComponent = LONGINT; CONST kSMPToAddress = kMailToBit; kSMPCCAddress = kMailCcBit; kSMPBCCAddress = kMailBccBit; TYPE SMPAddressType = MailAttributeID; CONST kSMPUndoCommand = 0; kSMPCutCommand = 1; kSMPCopyCommand = 2; kSMPPasteCommand = 3; kSMPClearCommand = 4; kSMPSelectAllCommand = 5; TYPE SMPEditCommand = INTEGER; CONST kSMPUndoDisabled = 0; kSMPAppMayUndo = 1; kSMPMailerUndo = 2; TYPE SMPUndoState = INTEGER; { SMPSendFormatMask: Bitfield indicating which combinations of formats are included in, should be included or, or can be included in a letter. } CONST kSMPNativeBit = 0; kSMPImageBit = 1; kSMPStandardInterchangeBit = 2; { Values of SMPSendFormatMask } CONST kSMPNativeMask = $00000001; {1<<kSMPNativeBit} kSMPImageMask = $00000002; {1<<kSMPImageBit} kSMPStandardInterchangeMask = $00000004; {1<<kSMPStandardInterchangeBit} TYPE SMPSendFormatMask = LONGINT; { Pseudo-events passed to the clients filter proc for initialization and cleanup. } CONST kSMPSendOptionsStart = -1; kSMPSendOptionsEnd = -2; { SMPSendFormatMask: Structure describing the format of a letter. If kSMPNativeMask bit is set, the whichNativeFormat field indicates which of the client-defined formats to use. } TYPE SMPSendFormat = RECORD whichFormats: SMPSendFormatMask; whichNativeFormat: INTEGER; { 0 based } END; SMPLetterInfo = RECORD letterCreator: OSType; letterType: OSType; subject: RString32; sender: RString32; END; CONST kSMPSave = 0; kSMPSaveAs = 1; kSMPSaveACopy = 2; TYPE SMPSaveType = INTEGER; FrontWindowProcPtr = ProcPtr; { FUNCTION FrontWindowProcPtr(clientData: LONGINT): WindowPtr;} PrepareMailerForDrawingProcPtr = ProcPtr; { FUNCTION PrepareMailerForDrawingProcPtr( window: WindowPtr; clientData: LONGINT): void;} SendOptionsFilterProc = ProcPtr; { FUNCTION SendOptionsFilterProc(theDialog: DialogPtr; VAR theEvent: EventRecord; itemHit: INTEGER; clientData: LONGINT): BOOLEAN;} CONST kSMPGetDimensions = 4700; kSMPNewMailer = 4701; kSMPDisposeMailer = 4702; kSMPMailerEvent = 4703; kSMPMailerEditCommand = 4704; kSMPMailerForward = 4705; kSMPMailerReply = 4706; kSMPGetMailerState = 4707; kSMPPrepareCoverPages = 4708; kSMPDrawNthCoverPage = 4709; kSMPBeginSave = 4710; kSMPBeginSend = 4711; kSMPOpenLetter = 4712; kSMPDrawMailer = 4713; kSMPMoveMailer = 4714; kSMPSetSubject = 4715; kSMPSetFromIdentity = 4716; kSMPAddAddress = 4717; kSMPAddAttachment = 4718; kSMPContentChanged = 4719; kSMPEndSave = 4720; kSMPEndSend = 4721; kSMPExpandOrContract = 4722; kSMPBecomeTarget = 4723; kSMPGetTabInfo = 4724; kSMPClearUndo = 4725; kSMPAttachDialog = 4726; kSMPGetComponentSize = 4727; kSMPGetComponentInfo = 4728; kSMPGetListItemInfo = 4729; kSMPAddContent = 4730; kSMPReadContent = 4731; kSMPGetFontNameFromLetter = 4732; kSMPAddMainEnclosure = 4733; kSMPGetMainEnclosureFSSpec = 4734; kSMPAddBlock = 4735; kSMPReadBlock = 4736; kSMPEnumerateBlocks = 4737; kSMPImage = 4738; kSMPInitMailer = 4741; kSMPGetNextLetter = 4742; kSMPPrepareToClose = 4743; kSMPCloseOptionsDialog = 4744; kSMPPrepareToChange = 4745; kSMPGetLetterInfo = 4746; kSMPTagDialog = 4747; kSMPSendOptionsDialog = 5000; TYPE SMPMailerState = RECORD mailerCount: INTEGER; currentMailer: INTEGER; upperLeft: Point; hasBeenReceived: BOOLEAN; isTarget: BOOLEAN; isExpanded: BOOLEAN; canMoveToTrash: BOOLEAN; canTag: BOOLEAN; {padByte2: Byte;} changeCount: LONGINT; targetComponent: SMPMailerComponent; canCut: BOOLEAN; canCopy: BOOLEAN; canPaste: BOOLEAN; canClear: BOOLEAN; canSelectAll: BOOLEAN; {padByte3: Byte;} undoState: SMPUndoState; undoWhat: Str63; END; SMPSendOptions = RECORD signWhenSent: BOOLEAN; priority: IPMPriority; END; SMPSendOptionsPtr = ^SMPSendOptions; SMPSendOptionsHandle = ^SMPSendOptionsPtr; SMPCloseOptions = RECORD moveToTrash: BOOLEAN; addTag: BOOLEAN; tag: RString32; END; SMPCloseOptionsPtr = ^SMPCloseOptions; {---------------------------------------------------------------------------------------- Send Package Routines ----------------------------------------------------------------------------------------} CONST kSMPSendLetter = 500; kSMPResolveToRecipient = 1100; kSMPNewPage = 2100; kSMPImageErr = 2101; FUNCTION SMPSendLetter(theLetter: SMPLetterPBPtr): OSErr; INLINE $203C, 2, kSMPSendLetter, $AA5D; FUNCTION SMPNewPage(VAR newHeader: OpenCPicParams): OSErr; INLINE $203C, 2, kSMPNewPage, $AA5D; FUNCTION SMPImageErr: OSErr; INLINE $203C, 0, kSMPImageErr, $AA5D; FUNCTION SMPResolveToRecipient(dsSpec: PackedDSSpecPtr; VAR recipientList: SMPRecipientDescriptorPtr; identity: AuthIdentity): OSErr; INLINE $203C, 6, kSMPResolveToRecipient, $AA5D; FUNCTION SMPInitMailer(mailerVersion: LONGINT): OSErr; INLINE $203C, 2, kSMPInitMailer, $AA5D; FUNCTION SMPGetDimensions(VAR width: INTEGER; VAR contractedHeight: INTEGER; VAR expandedHeight: INTEGER): OSErr; INLINE $203C, 6, kSMPGetDimensions, $AA5D; FUNCTION SMPGetTabInfo(VAR firstTab: SMPMailerComponent; VAR lastTab: SMPMailerComponent): OSErr; INLINE $203C, 4, kSMPGetTabInfo, $AA5D; FUNCTION SMPNewMailer(window: WindowPtr; upperLeft: Point; canContract: BOOLEAN; initiallyExpanded: BOOLEAN; identity: AuthIdentity; prepareMailerForDrawingCB: PrepareMailerForDrawingProcPtr; clientData: LONGINT): OSErr; INLINE $203C, 12, kSMPNewMailer, $AA5D; FUNCTION SMPPrepareToClose(window: WindowPtr): OSErr; INLINE $203C, 2, kSMPPrepareToClose, $AA5D; FUNCTION SMPCloseOptionsDialog(window: WindowPtr; closeOptions: SMPCloseOptionsPtr): OSErr; INLINE $203C, 4, kSMPCloseOptionsDialog, $AA5D; FUNCTION SMPTagDialog(window: WindowPtr; theTag: RString32Ptr): OSErr; INLINE $203C, 4, kSMPTagDialog, $AA5D; FUNCTION SMPDisposeMailer(window: WindowPtr; closeOptions: SMPCloseOptionsPtr): OSErr; INLINE $203C, 4, kSMPDisposeMailer, $AA5D; FUNCTION SMPMailerEvent(event: EventRecord; VAR whatHappened: SMPMailerResult; frontWindowCB: FrontWindowProcPtr; clientData: LONGINT): OSErr; INLINE $203C, 8, kSMPMailerEvent, $AA5D; FUNCTION SMPClearUndo(window: WindowPtr): OSErr; INLINE $203C, 2, kSMPClearUndo, $AA5D; FUNCTION SMPMailerEditCommand(window: WindowPtr; command: SMPEditCommand; VAR whatHappened: SMPMailerResult): OSErr; INLINE $203C, 5, kSMPMailerEditCommand, $AA5D; FUNCTION SMPMailerForward(window: WindowPtr; from: AuthIdentity): OSErr; INLINE $203C, 4, kSMPMailerForward, $AA5D; FUNCTION SMPMailerReply(originalLetter: WindowPtr; newLetter: WindowPtr; replyToAll: BOOLEAN; upperLeft: Point; canContract: BOOLEAN; initiallyExpanded: BOOLEAN; identity: AuthIdentity; prepareMailerForDrawingCB: PrepareMailerForDrawingProcPtr; clientData: LONGINT): OSErr; INLINE $203C, 15, kSMPMailerReply, $AA5D; FUNCTION SMPGetMailerState(window: WindowPtr; VAR itsState: SMPMailerState): OSErr; INLINE $203C, 4, kSMPGetMailerState, $AA5D; FUNCTION SMPSendOptionsDialog(window: WindowPtr; documentName: Str255; VAR nativeFormatNames: StringPtr; nameCount: INTEGER; canSend: SMPSendFormatMask; VAR currentFormat: SMPSendFormat; filterProc: SendOptionsFilterProc; clientData: LONGINT; VAR shouldSend: SMPSendFormat; sendOptions: SMPSendOptionsPtr): OSErr; INLINE $203C, 19, kSMPSendOptionsDialog, $AA5D; FUNCTION SMPPrepareCoverPages(window: WindowPtr; VAR pageCount: INTEGER): OSErr; INLINE $203C, 4, kSMPPrepareCoverPages, $AA5D; FUNCTION SMPDrawNthCoverPage(window: WindowPtr; pageNumber: INTEGER; doneDrawingCoverPages: BOOLEAN): OSErr; INLINE $203C, 4, kSMPDrawNthCoverPage, $AA5D; FUNCTION SMPPrepareToChange(window: WindowPtr): OSErr; INLINE $203C, 2, kSMPPrepareToChange, $AA5D; FUNCTION SMPContentChanged(window: WindowPtr): OSErr; INLINE $203C, 2, kSMPContentChanged, $AA5D; FUNCTION SMPBeginSave(window: WindowPtr; diskLetter: FSSpec; creator: OSType; fileType: OSType; saveType: SMPSaveType; VAR mustAddContent: BOOLEAN): OSErr; INLINE $203C, 11, kSMPBeginSave, $AA5D; FUNCTION SMPEndSave(window: WindowPtr; okToSave: BOOLEAN): OSErr; INLINE $203C, 3, kSMPEndSave, $AA5D; FUNCTION SMPBeginSend(window: WindowPtr; creator: OSType; fileType: OSType; sendOptions: SMPSendOptionsPtr; VAR mustAddContent: BOOLEAN): OSErr; INLINE $203C, 10, kSMPBeginSend, $AA5D; FUNCTION SMPEndSend(window: WindowPtr; okToSend: BOOLEAN): OSErr; INLINE $203C, 3, kSMPEndSend, $AA5D; FUNCTION SMPOpenLetter(letter: LetterDescriptor; window: WindowPtr; upperLeft: Point; canContract: BOOLEAN; initiallyExpanded: BOOLEAN; prepareMailerForDrawingCB: PrepareMailerForDrawingProcPtr; clientData: LONGINT): OSErr; INLINE $203C, 12, kSMPOpenLetter, $AA5D; FUNCTION SMPAddMainEnclosure(window: WindowPtr; enclosure: FSSpec): OSErr; INLINE $203C, 4, kSMPAddMainEnclosure, $AA5D; FUNCTION SMPGetMainEnclosureFSSpec(window: WindowPtr; VAR enclosureDir: FSSpec): OSErr; INLINE $203C, 4, kSMPGetMainEnclosureFSSpec, $AA5D; FUNCTION SMPAddContent(window: WindowPtr; segmentType: MailSegmentType; appendFlag: BOOLEAN; buffer: UNIV Ptr; bufferSize: LONGINT; textScrap: StScrpPtr; startNewScript: BOOLEAN; script: ScriptCode): OSErr; INLINE $203C, 12, kSMPAddContent, $AA5D; FUNCTION SMPReadContent(window: WindowPtr; segmentTypeMask: MailSegmentMask; buffer: UNIV Ptr; bufferSize: LONGINT; VAR dataSize: LONGINT; VAR textScrap: StScrpRec; VAR script: ScriptCode; VAR segmentType: MailSegmentType; VAR endOfScript: BOOLEAN; VAR endOfSegment: BOOLEAN; VAR endOfContent: BOOLEAN; VAR segmentLength: LONGINT; VAR segmentID: LONGINT): OSErr; INLINE $203C, 25, kSMPReadContent, $AA5D; FUNCTION SMPGetFontNameFromLetter(window: WindowPtr; fontNum: INTEGER; fontName: Str255; doneWithFontTable: BOOLEAN): OSErr; INLINE $203C, 6, kSMPGetFontNameFromLetter, $AA5D; FUNCTION SMPAddBlock(window: WindowPtr; blockType: OCECreatorType; append: BOOLEAN; buffer: UNIV Ptr; bufferSize: LONGINT; mode: MailBlockMode; offset: LONGINT): OSErr; INLINE $203C, 12, kSMPAddBlock, $AA5D; FUNCTION SMPReadBlock(window: WindowPtr; blockType: OCECreatorType; blockIndex: INTEGER; buffer: UNIV Ptr; bufferSize: LONGINT; dataOffset: LONGINT; VAR dataSize: LONGINT; VAR endOfBlock: BOOLEAN; VAR remaining: LONGINT): OSErr; INLINE $203C, 17, kSMPReadBlock, $AA5D; FUNCTION SMPEnumerateBlocks(window: WindowPtr; startIndex: INTEGER; buffer: UNIV Ptr; bufferSize: LONGINT; VAR dataSize: LONGINT; VAR nextIndex: INTEGER; VAR more: BOOLEAN): OSErr; INLINE $203C, 13, kSMPEnumerateBlocks, $AA5D; FUNCTION SMPDrawMailer(window: WindowPtr): OSErr; INLINE $203C, 2, kSMPDrawMailer, $AA5D; FUNCTION SMPSetSubject(window: WindowPtr; text: RString): OSErr; INLINE $203C, 4, kSMPSetSubject, $AA5D; FUNCTION SMPSetFromIdentity(window: WindowPtr; from: AuthIdentity): OSErr; INLINE $203C, 4, kSMPSetFromIdentity, $AA5D; FUNCTION SMPAddAddress(window: WindowPtr; addrType: SMPAddressType; address: OCEPackedRecipientPtr): OSErr; INLINE $203C, 5, kSMPAddAddress, $AA5D; FUNCTION SMPAddAttachment(window: WindowPtr; attachment: FSSpec): OSErr; INLINE $203C, 4, kSMPAddAttachment, $AA5D; FUNCTION SMPAttachDialog(window: WindowPtr): OSErr; INLINE $203C, 2, kSMPAttachDialog, $AA5D; FUNCTION SMPExpandOrContract(window: WindowPtr; expand: BOOLEAN): OSErr; INLINE $203C, 3, kSMPExpandOrContract, $AA5D; FUNCTION SMPMoveMailer(window: WindowPtr; dh: INTEGER; dv: INTEGER): OSErr; INLINE $203C, 4, kSMPMoveMailer, $AA5D; FUNCTION SMPBecomeTarget(window: WindowPtr; becomeTarget: BOOLEAN; whichField: SMPMailerComponent): OSErr; INLINE $203C, 5, kSMPBecomeTarget, $AA5D; FUNCTION SMPGetComponentSize(window: WindowPtr; whichMailer: INTEGER; whichField: SMPMailerComponent; VAR size: INTEGER): OSErr; INLINE $203C, 7, kSMPGetComponentSize, $AA5D; FUNCTION SMPGetComponentInfo(window: WindowPtr; whichMailer: INTEGER; whichField: SMPMailerComponent; buffer: UNIV Ptr): OSErr; INLINE $203C, 7, kSMPGetComponentInfo, $AA5D; FUNCTION SMPGetListItemInfo(window: WindowPtr; whichMailer: INTEGER; whichField: SMPMailerComponent; buffer: UNIV Ptr; bufferLength: LONGINT; startItem: INTEGER; VAR itemCount: INTEGER; VAR nextItem: INTEGER; VAR more: BOOLEAN): OSErr; INLINE $203C, 16, kSMPGetListItemInfo, $AA5D; FUNCTION SMPImage( window: WindowPtr; drawImageProc: SMPDrawImageProcPtr; imageRefCon: LONGINT; supportsColor: BOOLEAN): OSErr; INLINE $203C, 7, kSMPImage, $AA5D; FUNCTION SMPGetNextLetter(VAR typesList: OSType; numTypes: INTEGER; VAR adjacentLetter: LetterDescriptor): OSErr; INLINE $203C, 5, kSMPGetNextLetter, $AA5D; FUNCTION SMPGetLetterInfo(VAR mailboxSpec: LetterSpec; VAR info: SMPLetterInfo): OSErr; INLINE $203C, 4, kSMPGetLetterInfo, $AA5D; {$ENDC} { UsingOCEStandardMail } {$IFC NOT UsingIncludes} END. {$ENDC}